mui.ready(function() {
	//	rem适配
	document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + "px";
	window.addEventListener("resize", setRemSize, false);
	
	function setRemSize() {
		document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + "px";
	}
	//首页页面跳转判断
	document.querySelector(".my").addEventListener('tap', function() {
		if (sessionStorage.token == undefined) {
			mui.openWindow({
				url: 'html/login.html',

			});
		} else {
			mui.openWindow({

				url: 'html/homepage.html',
			});
		}

	});

	document.getElementById('re_charge').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/re_charge.html',

		});
	});

	document.getElementById('transfer').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/transfer.html',

		});
	});

	document.getElementById('give_cash').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/give_cash.html',

		});
	});

	document.getElementById('checkRMB').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/checkRMB.html',

		});
	});

	document.getElementById('business').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/business.html',
		});
	});
	document.getElementById('collect_money').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/collect_money.html',
		});
	});
	document.getElementById('QR_Code').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/QR_Code.html',
		});
	});
	document.getElementById('share').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/share.html',
		});
	});
	document.getElementById('friend').addEventListener('tap', function() {
		mui.openWindow({
			url: 'html/map.html',
		});
	});
	document.querySelector(".message").addEventListener("tap", function() {
		mui.openWindow({
			url: "html/map.html",
		});
	});
	//轮播
		var gallery = mui('.mui-slider');
		gallery.slider({
			interval: 2000 //自动轮播周期，若为0则不自动播放，默认为0；
		});
		
//		mui.ajax("/api/v1/common/getIndexImages", {
//			data: {},
//			dataType: 'json',
//			type: 'post',
//			success: function(data) {
//				var obj = eval('(' + data.data + ')');
//				var i;
//				for (i in obj.indexImages) {
//					var num=obj.indexImages[i].sort;
//						console.log(obj.indexImages[i].img)
//						document.querySelector(".img"+num).src=obj.indexImages[i].img;	
//				}	
//			},
//			error: function(xhr, type, errorThrown) {
//				//异常处理；
//				console.log(type);
//			}
//		});
//      动态写入轮播图
})